-
Notifications
You must be signed in to change notification settings - Fork 1
/
wf_01_a.py
68 lines (65 loc) · 2.28 KB
/
wf_01_a.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import sys
import os
import mupif
import mupif as mp
import numpy as np
import Pyro5.api
import time
import logging
log=logging.getLogger()
@Pyro5.api.expose
class Eudoxos_WF_01_a(mp.Model):
def __init__(self,metadata=None):
MD = {
"Name": "UNIX timestamp",
"ID": "Eudoxos_WF_01_a",
"Description": "Return current UNIX timestamp",
"Version_date": "1.0.0, August 2022",
'Physics': {'Type':'Other','Entity':'Other'},
"Outputs": [
{
"Name": "timestamp",
"Type_ID": 'mupif.DataID.PID_Time',
"Type": "mupif.Property",
"Required": False,
"Units": "s",
"ValueType": "Scalar",
}
],
"Inputs":[],
"Solver":{
'Software': 'Python script',
'Language': 'Python3',
'License': 'LGPL',
'Creator': 'Eudoxos',
'Version_date': '08/2022',
'Type': 'Summator',
'Documentation': 'Nowhere',
'Estim_time_step_s': 1,
'Estim_comp_time_s': 0.01,
'Estim_execution_cost_EUR': 0.01,
'Estim_personnel_cost_EUR': 0.01,
'Required_expertise': 'None',
'Accuracy': 'High',
'Sensitivity': 'High',
'Complexity': 'Low',
'Robustness': 'High'
},
'Execution':{ 'ID': '123' }
}
super().__init__(metadata=MD)
self.updateMetadata(metadata)
self.timestamp=np.nan*mp.U.s
def get(self,objectTypeID,time=None,objectID=''):
if objectTypeID==mp.DataID.PID_Time:
return mp.ConstantProperty(quantity=self.timestamp,propID=objectTypeID,time=time)
def solveStep(self, tstep,stageID=0,runInBackground=False):
import socket
log.error(f'+ This is solveStep in the wf_01_a model running on {socket.getfqdn()=}')
log.error(f'+ {os.environ["MUPIF_LOG_PYRO"]=}')
self.timestamp=time.time()*mp.U.s
for i in range(180):
log.error(f'Tick is {i}/180')
time.sleep(1)
# Eudoxos_WF_01_a.__module__='wf_01_a'
# locate nameserver