Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
078c6368
Commit
078c6368
authored
Mar 18, 2019
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Plc function object Random added
parent
cc65722b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
172 additions
and
1 deletion
+172
-1
src/doc/orm/src/orm_random_fo.png
src/doc/orm/src/orm_random_fo.png
+0
-0
src/lib/rt/src/rt_plc_arithm.c
src/lib/rt/src/rt_plc_arithm.c
+15
-0
src/lib/rt/src/rt_plc_arithm.h
src/lib/rt/src/rt_plc_arithm.h
+1
-0
src/wbl/pwrb/src/pwrb_c_random.wb_load
src/wbl/pwrb/src/pwrb_c_random.wb_load
+150
-0
wb/exp/wb/src/pwr_wb_palette.cnf
wb/exp/wb/src/pwr_wb_palette.cnf
+6
-1
No files found.
src/doc/orm/src/orm_random_fo.png
0 → 100644
View file @
078c6368
1.31 KB
src/lib/rt/src/rt_plc_arithm.c
View file @
078c6368
...
@@ -1084,6 +1084,21 @@ void Min_exec(plc_sThread* tp, pwr_sClass_Min* o)
...
@@ -1084,6 +1084,21 @@ void Min_exec(plc_sThread* tp, pwr_sClass_Min* o)
o
->
ActVal
=
result
;
o
->
ActVal
=
result
;
}
}
/*_*
Random Random value generator.
@aref random Random
*/
void
Random_exec
(
plc_sThread
*
tp
,
pwr_sClass_Random
*
o
)
{
if
(
o
->
CondP
==
&
o
->
Cond
)
o
->
ActVal
=
o
->
MinValue
+
(
float
)(
rand
())
/
RAND_MAX
*
(
o
->
MaxValue
-
o
->
MinValue
);
else
{
if
(
*
o
->
CondP
&&
!
o
->
CondOld
)
o
->
ActVal
=
o
->
MinValue
+
(
float
)(
rand
())
/
RAND_MAX
*
(
o
->
MaxValue
-
o
->
MinValue
);
o
->
CondOld
=
*
o
->
CondP
;
}
}
/*_*
/*_*
BwShiftLeft Bitwise shift left.
BwShiftLeft Bitwise shift left.
@aref bwshiftleft BwShiftLeft
@aref bwshiftleft BwShiftLeft
...
...
src/lib/rt/src/rt_plc_arithm.h
View file @
078c6368
...
@@ -90,6 +90,7 @@ void Sub_exec(plc_sThread* tp, pwr_sClass_Sub* object);
...
@@ -90,6 +90,7 @@ void Sub_exec(plc_sThread* tp, pwr_sClass_Sub* object);
void
Div_exec
(
plc_sThread
*
tp
,
pwr_sClass_Div
*
object
);
void
Div_exec
(
plc_sThread
*
tp
,
pwr_sClass_Div
*
object
);
void
Max_exec
(
plc_sThread
*
tp
,
pwr_sClass_Max
*
object
);
void
Max_exec
(
plc_sThread
*
tp
,
pwr_sClass_Max
*
object
);
void
Min_exec
(
plc_sThread
*
tp
,
pwr_sClass_Min
*
object
);
void
Min_exec
(
plc_sThread
*
tp
,
pwr_sClass_Min
*
object
);
void
Random_exec
(
plc_sThread
*
tp
,
pwr_sClass_Random
*
o
);
void
BwShiftLeft_exec
(
plc_sThread
*
tp
,
pwr_sClass_BwShiftLeft
*
object
);
void
BwShiftLeft_exec
(
plc_sThread
*
tp
,
pwr_sClass_BwShiftLeft
*
object
);
void
BwShiftRight_exec
(
plc_sThread
*
tp
,
pwr_sClass_BwShiftRight
*
object
);
void
BwShiftRight_exec
(
plc_sThread
*
tp
,
pwr_sClass_BwShiftRight
*
object
);
void
BwRotateRight_exec
(
plc_sThread
*
tp
,
pwr_sClass_BwRotateRight
*
object
);
void
BwRotateRight_exec
(
plc_sThread
*
tp
,
pwr_sClass_BwRotateRight
*
object
);
...
...
src/wbl/pwrb/src/pwrb_c_random.wb_load
0 → 100644
View file @
078c6368
!
! ProviewR Open Source Process Control.
! Copyright (C) 2005-2019 SSAB EMEA AB.
!
! This file is part of ProviewR.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with ProviewR. If not, see <http://www.gnu.org/licenses/>
!
! Linking ProviewR statically or dynamically with other modules is
! making a combined work based on ProviewR. Thus, the terms and
! conditions of the GNU General Public License cover the whole
! combination.
!
! In addition, as a special exception, the copyright holders of
! ProviewR give you permission to, from the build function in the
! ProviewR Configurator, combine ProviewR with modules generated by the
! ProviewR PLC Editor to a PLC program, regardless of the license
! terms of these modules. You may copy and distribute the resulting
! combined work under the terms of your choice, provided that every
! copy of the combined work is accompanied by a complete copy of
! the source code of ProviewR (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_c_random.wb_load -- Defines the class Random.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Code rt_plc_arithm.c
! @Group Plc,PlcAnalog
! @Summary Random value generator
! Random value generator.
! @image orm_random_fo.png
!
! Generates a random analog value between the supplied min and max values.
! If the condition input is connected, a new value is generated on a leading edge
! on Cond. If Cond is not connected, a new value is generated every scan.
!*/
Object Random $ClassDef 711
Body SysBody
Attr Editor = pwr_eEditor_PlcEd
Attr Method = pwr_eMethod_Connections
Attr PopEditor = 2
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "Random"
EndBody
!/**
! Condition. If connected, a new value is generated on leading
! edge. If not connected, a new value is generated every scan.
!*/
Object Cond $Input 1
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_NOINVERT
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr GraphName = "Cond"
EndBody
EndObject
!/**
! Mininum value for the generated value.
!*/
Object MinValue $Intern 2
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Maximum value for generated value.
!*/
Object MaxValue $Intern 3
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Stored value of Cond.
!*/
Object CondOld $Intern 4
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_REDUTRANSFER
EndBody
EndObject
!/**
! Output that contains the random value.
!*/
Object ActVal $Output 5
Body SysBody
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_REDUTRANSFER
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "Val"
EndBody
EndObject
EndObject
Object DevBody $ObjBodyDef 2
Object PlcNode $Buffer 1
Body SysBody
Attr Class = pwr_eClass_PlcNode
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
EndObject
EndObject
Object GraphPlcNode $GraphPlcNode
Body SysBody
Attr object_type = 11
Attr parameters[0] = 1
Attr parameters[1] = 3
Attr parameters[2] = 1
Attr parameters[3] = 0
Attr subwindows = 0
Attr graphmethod = 1
Attr graphindex = 0
Attr default_mask[0] = 0
Attr default_mask[1] = 1
Attr segname_annotation = 1
Attr compmethod = 4
Attr compindex = 0
Attr tracemethod = 0
Attr traceindex = 0
Attr executeordermethod = 2
Attr objname = "Random"
Attr graphname = "Random"
EndBody
EndObject
Object Template Random
Body RtBody
Attr MaxValue = 100
EndBody
EndObject
EndObject
EndSObject
wb/exp/wb/src/pwr_wb_palette.cnf
View file @
078c6368
...
@@ -15,6 +15,7 @@ topobjects NavigatorW1
...
@@ -15,6 +15,7 @@ topobjects NavigatorW1
class $Hier
class $Hier
class $Alias
class $Alias
class $MountObject
class $MountObject
class $MountDynObject
class $MountVolume
class $MountVolume
class ProjectReg
class ProjectReg
class VolumeReg
class VolumeReg
...
@@ -72,6 +73,7 @@ palette NavigatorPalette
...
@@ -72,6 +73,7 @@ palette NavigatorPalette
class DsFastCurve
class DsFastCurve
class DsTrend
class DsTrend
class DsTrendCurve
class DsTrendCurve
class SevExport
class SevHist
class SevHist
class SevHistObject
class SevHistObject
menu CircularBuffer
menu CircularBuffer
...
@@ -239,7 +241,8 @@ palette NavigatorPalette
...
@@ -239,7 +241,8 @@ palette NavigatorPalette
class PlcPgm
class PlcPgm
class Backup
class Backup
class $LibHier
class $LibHier
class $Mountobject
class $MountObject
class $MountDynObject
class $Alias
class $Alias
}
}
menu Node
menu Node
...
@@ -268,6 +271,7 @@ palette NavigatorPalette
...
@@ -268,6 +271,7 @@ palette NavigatorPalette
class SimulateConfig
class SimulateConfig
class SevHistMonitor
class SevHistMonitor
class SevHistThread
class SevHistThread
class SevImportServer
class SevServer
class SevServer
class StatusServerConfig
class StatusServerConfig
class SysMonConfig
class SysMonConfig
...
@@ -772,6 +776,7 @@ palette PlcEditorPalette
...
@@ -772,6 +776,7 @@ palette PlcEditorPalette
class NotEqual
class NotEqual
class PiSpeed
class PiSpeed
class Ramp
class Ramp
class Random
class Select
class Select
class ScanTime
class ScanTime
class Speed
class Speed
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment