FEDEM Solver  R8.0
Source code of the dynamics solver
FiDACFile.H
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2023 SAP SE
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 // This file is part of FEDEM - https://openfedem.org
7 
8 #ifndef FI_DAC_FILE_H
9 #define FI_DAC_FILE_H
10 
11 #include "FiDeviceFunctionBase.H"
12 
13 
15 {
16 public:
17  FiDACFile(const char* devicename = NULL, Endianness format = LittleEndian);
18  virtual ~FiDACFile() {}
19 
20  virtual size_t getValueCount() const { return myNumDatavals; }
21  virtual void getValueRange(double& min, double& max) const;
22  virtual double getXAxisOrigin() const { return myXaxisOrigin; }
23 
24  virtual double getValue(double x, int = 0,
25  bool zeroAdjust = false, double vertShift = 0.0,
26  double scaleFac = 1.0);
27  virtual bool getValues(double x0, double x1,
28  std::vector<double>& x, std::vector<double>& y,
29  int channel = 0, bool zeroAdjust = false,
30  double shift = 0.0, double scale = 1.0);
31  virtual void getRawData(std::vector<double>& x, std::vector<double>& y,
32  double minX = 0.0, double maxX = -1.0, int = 0);
33  virtual void setValue(double x, double y);
34  virtual bool setData(const std::vector<double>& x,
35  const std::vector<double>& y);
36 
37 protected:
38  virtual bool initialDeviceRead();
39  virtual bool preliminaryDeviceWrite();
40  virtual bool concludingDeviceWrite(bool);
41 
42  void updateStatistics(double val);
43 
44 private:
45  double getValueAt(unsigned long pos);
46 
47  float readFloat(int pos); // DAC dump position
48  short readInt16(int pos); // DAC INT no (=Dump position 33A +)
49  int readInt32(int pos); // DAC Dump position
50  std::string readString(int start, int end, // DAC dump start & stop
51  int startOffset = 0, int endoffset = 0);
52 
53  void writeFloat(int pos, float val); // DAC dump position
54  void writeInt16(int pos, int val); // DAC INT no (=Dump position 33A +)
55  void writeInt32(int pos, int val); // DAC Dump position
56  int writeString(int start, int end, // DAC dump start & stop
57  const std::string& val,
58  int startOffset = 0, int endoffset = 0);
59 
60 protected:
61  unsigned long myNumDatavals;
62  double myXaxisOrigin;
63 
65 
66  double myLastXVal;
67  double myLastYVal;
68 
69  double myMean;
70  double myMS;
71  double myMaxVal;
72  double myMinVal;
73 
74  unsigned long maxPos;
75  unsigned long minPos;
76 
77 private:
79 };
80 
81 #endif
Definition: FiDACFile.H:15
double myFirstReadValue
Definition: FiDACFile.H:64
virtual void setValue(double x, double y)
Definition: FiDACFile.C:370
double myLastXVal
Definition: FiDACFile.H:66
virtual size_t getValueCount() const
Definition: FiDACFile.H:20
unsigned long myNumDatavals
Definition: FiDACFile.H:61
double getValueAt(unsigned long pos)
Definition: FiDACFile.C:265
unsigned long maxPos
Definition: FiDACFile.H:74
void writeFloat(int pos, float val)
Definition: FiDACFile.C:510
double myMS
Definition: FiDACFile.H:70
double myLastYVal
Definition: FiDACFile.H:67
virtual double getValue(double x, int=0, bool zeroAdjust=false, double vertShift=0.0, double scaleFac=1.0)
Definition: FiDACFile.C:199
virtual bool getValues(double x0, double x1, std::vector< double > &x, std::vector< double > &y, int channel=0, bool zeroAdjust=false, double shift=0.0, double scale=1.0)
Definition: FiDACFile.C:293
double myMaxVal
Definition: FiDACFile.H:71
virtual bool initialDeviceRead()
Definition: FiDACFile.C:37
double myXaxisOrigin
Definition: FiDACFile.H:62
virtual void getRawData(std::vector< double > &x, std::vector< double > &y, double minX=0.0, double maxX=-1.0, int=0)
Definition: FiDACFile.C:275
double myMinVal
Definition: FiDACFile.H:72
FiDACFile(const char *devicename=NULL, Endianness format=LittleEndian)
Definition: FiDACFile.C:21
int readInt32(int pos)
Definition: FiDACFile.C:476
virtual bool preliminaryDeviceWrite()
Definition: FiDACFile.C:87
virtual void getValueRange(double &min, double &max) const
Definition: FiDACFile.C:192
void updateStatistics(double val)
Definition: FiDACFile.C:408
void writeInt32(int pos, int val)
Definition: FiDACFile.C:533
virtual bool concludingDeviceWrite(bool)
Definition: FiDACFile.C:120
bool isDataWriteInited
Definition: FiDACFile.H:78
virtual bool setData(const std::vector< double > &x, const std::vector< double > &y)
Definition: FiDACFile.C:335
std::string readString(int start, int end, int startOffset=0, int endoffset=0)
Definition: FiDACFile.C:492
int writeString(int start, int end, const std::string &val, int startOffset=0, int endoffset=0)
Definition: FiDACFile.C:544
virtual double getXAxisOrigin() const
Definition: FiDACFile.H:22
void writeInt16(int pos, int val)
Definition: FiDACFile.C:521
float readFloat(int pos)
Definition: FiDACFile.C:444
short readInt16(int pos)
Definition: FiDACFile.C:460
unsigned long minPos
Definition: FiDACFile.H:75
double myMean
Definition: FiDACFile.H:69
virtual ~FiDACFile()
Definition: FiDACFile.H:18
Definition: FiDeviceFunctionBase.H:19
Endianness
Definition: FiDeviceFunctionBase.H:29
@ LittleEndian
Definition: FiDeviceFunctionBase.H:29
integer(ptr), save, private x
Definition: extCtrlSysRoutinesModule.f90:16
integer channel
Column index for data file.
Definition: initiateFunctionTypeModule.f90:26
subroutine scale(vec, a)
Definition: windTurbineRoutinesModule.f90:510